package cn;
import cn.configure.SettingConfigure;
import cn.swing.ui.Error;
import cn.swing.ui.QR;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.File;
/**
 * @author xbsoft2
 */
public class QRApplication {
  public static void main(String[] args) {
    start();
  }
  private static void start() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      JFrame frame = new JFrame("二维码生成器");
      frame.setContentPane(new QR().getRootPanel());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setBounds(500, 250, 550, 600);
      SettingConfigure settingConfigure = SettingConfigure.getSettingConfigure();
      String logo = settingConfigure.getQrCodeSetting().getLogo();
      File file = new File(logo);
      if (file.exists() && file.isFile()) {
        frame.setIconImage(ImageIO.read(file));
      }
      frame.setVisible(true);
    }
    catch (Exception e) {
      e.printStackTrace();
      new Error("启动失败:\n" + e.getMessage());
    }
  }
}
